{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript">
$(function(){
	
	$("[name='style_size_sn_id']").change(function(){
		var ss_cq_sizename_list='{$sizename_list_json}';
		ss_cq_sizename_list=eval('('+ss_cq_sizename_list+')');
		if(ss_cq_sizename_list!="")
		{
			var type=$(this).val();
			var fields_name=ss_cq_sizename_list[type];
			var tr=$(this).parent().parent();
			tr.find("[cqindex='2']").html(fields_name['v2_name']);
			tr.find("[cqindex='3']").html(fields_name['v3_name']);
			tr.find("[cqindex='4']").html(fields_name['v4_name']);
			tr.find("[cqindex='5']").html(fields_name['v5_name']);
			tr.find("[cqindex='6']").html(fields_name['v6_name']);
		}
	});	
	
})


function remove_style_size(_this)
{
	if (!confirm('{$lang.are_you_sure}')) {
		return;
	}
	$(_this).parent().parent().remove();
}
function add_style_size()
{
	//alert('1111');
	var newTr = $('#one_size').clone(true);
	newTr.css("display","");
	$('#tj').before(newTr);
}

function change_size(_this){
	return;
	var code = new Number($(_this).parent().parent().children(":nth-child(8)").children(":only-child").val());
	var a = $(_this).parent().parent().children().children();
	var b;
	var c;
	a.each(function(i,n){
		if(i>0&&i<7){
			var obj = $(n);
			if(obj.attr("name")==$(_this).attr("name")){
				b = new Number(i);
				c = new Number($(_this).val());
			}
		}
		if($(_this).attr("name")=="code[]"){
			b = new Number(1);
			c = new Number($(_this).parent().parent().children(":nth-child(2)").children(":only-child").val());
		}
	});
	a.each(function(i,n){
		var obj = $(n);
		if(i>0&&i<7){
			obj.val(Math.round((c+(i-b)*code)*100)/100);
		}
	});
}
</script>
<body>
<div class="sub-body">
<div class="tab_info">
<div class="tab-title-1"><span>{$lang.style_manage}</span></div>
<form method="post">
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display" id="tab-color1">
      <tr><td>
<span>{$lang.style_name}</span>:

				<select onChange="location.href='{url app=style&act=edit_size&sid=}'+this.value" name="style_id" id="style_id" style=" margin-top:px;" >
                <option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$style_list item=style_item key=k}-->
					<option value="{$style_item.style_id}"{if $style_item.style_id == $style.style_id} selected{/if}>{$style_item.style_name}</option>
					<!--{/foreach}-->
				</select>
                </td>
                <td colspan="9">
<input type="button" onClick="add_style_size(this);" item="op" class="btn-2" value="{$lang.add}"  style="float:right;margin-right:10px;"/>
      
      </td></tr>
      <tr>
        <th width="20%">{$lang.position}</th>
		<th width="8%" cqindex="1">
       <select style=" width:50px;" name="style_size_sn_id">
       <!--{foreach from=$sizename_list item=sname }-->
                   <option value="{$sname.snid}" {if $sname.snid eq $style.style_size_sn_id}selected="selected"{/if}>{$sname.v1_name}</option>
       <!--{/foreach}-->
       </select></th>
       <th width="8%" cqindex="2">{$curr_size_sizename.v2_name}</th>
       <th width="8%" cqindex="3">{$curr_size_sizename.v3_name}</th>
       <th width="8%" cqindex="4">{$curr_size_sizename.v4_name}</th>
       <th width="8%" cqindex="5">{$curr_size_sizename.v5_name}</th>
       <th width="8%" cqindex="6">{$curr_size_sizename.v6_name}</th>
		<th width="8%">{$lang.code}</th>
		<th width="8%">{$lang.sort_order}</th>
		<th width="8%">{$lang.handle}</th>
      </tr>
      
      <!-- 一个用于增加的tr -->
      <tr id="one_size" style="display:none;">
        <td><input type="text" name="position[]" value="" class="input-1" style="width:100%;"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w6[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w8[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w10[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w12[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w14[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w16[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text"  onBlur="javascript:change_size(this);" name="code[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="sort_order[]" value="" class="input-1" style="width:100%;"></td>
        <td><input type="button" item="op" class="btn-2" value="{$lang.drop}" onClick="remove_style_size(this);" /></td>
      </tr>
      
	  <!--{foreach from=$style_size item=s key=k}-->
       <tr>
        <td><input type="text" name="position[]" value="{$s.position|escape}" class="input-1" style="width:100%;"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w6[]" value="{$s.w6|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w8[]" value="{$s.w8|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w10[]" value="{$s.w10|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w12[]" value="{$s.w12|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w14[]" value="{$s.w14|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="w16[]" value="{$s.w16|escape}" class="input-1" style="width:100%;"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="code[]" value="{$s.code|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="text" name="sort_order[]" value="{$s.sort_order|escape}" class="input-1" style="width:100%;"></td>
        <td><input type="button" item="op" class="btn-2" value="{$lang.drop}" onClick="remove_style_size(this);" /></td>
      </tr>
	  <!--{/foreach}-->
	  <tr id="tj">
	  	<td colspan="10"><input type="submit" class="btn-2" value="{$lang.save}"></td>
	  </tr>
    </table>
</form>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</div></div>
</body>
</html>